Auth

public class Auth : UserAuthAPI

Contains APIs that allow you get access to tokens and control some oauth related settings for a user

  • Get a one-time API authentication code for the current user.

    This code can be sent to a different API, or a different SDK (for example a JS SDK), and then exchanged for a new access token, which has the same powers the current access token. You must be in the logged in state to be able to call this method. See also a diagram for exchange type code on https://techdocs.login.schibsted.com/endpoints/POST/oauth/exchange/

    Declaration

    Swift

    @discardableResult
    public func oneTimeCode(clientID: String, completion: @escaping StringResultCallback) -> TaskHandle

    Parameters

    clientID

    which client to get the code on behalf of

    completion

    a callback that receives the code or an error.

  • Get an URL with embedded one-time code for creating a web session for the current user.

    Suppose that you have a mobile native login UI, but want to have a web view, where the user is logged in as if he has logged in via a web login form. The URL returned by this method should be used to navigate the web view, which will then redirect to your destination given redirectURL. After that happens you’ll have a session cookie for the current user set up in the web view. That makes it possible to navigate to personalised or protected web pages in the logged in state.

    You must be in the logged in state to be able to call this method. See also a diagram for exchange type session on https://techdocs.login.schibsted.com/endpoints/POST/oauth/exchange/

    Declaration

    Swift

    @discardableResult
    public func webSessionURL(clientID: String, redirectURL: URL, completion: @escaping URLResultCallback) -> TaskHandle

    Parameters

    clientID

    which client to get the code on behalf of

    redirectURL

    where to redirect a web view at the cookie is set.

    completion

    a callback that receives the code or an error.