AppAuth
Instance Methods | Properties | List of all members
OIDRedirectHTTPHandler Class Reference

Start a HTTP server on the loopback interface (i.e. 127.0.0.1) to receive the OAuth response redirects on macOS. More...

#import <OIDRedirectHTTPHandler.h>

Inheritance diagram for OIDRedirectHTTPHandler:

Instance Methods

(instancetype) - initWithSuccessURL:
 Creates an a loopback HTTP redirect URI handler with the given success URL. More...
 
(NSURL *) - startHTTPListener:withPort:
 Starts listening on the loopback interface on a specified port, and returns a URL with the base address. Use the returned redirect URI to build a OIDExternalUserAgentRequest, and once you initiate the request, set the resulting OIDExternalUserAgentSession to currentAuthorizationFlow so the response can be handled. More...
 
(NSURL *) - startHTTPListener:
 Starts listening on the loopback interface on a random available port, and returns a URL with the base address. Use the returned redirect URI to build a OIDExternalUserAgentRequest, and once you initiate the request, set the resulting OIDExternalUserAgentSession to currentAuthorizationFlow so the response can be handled. More...
 
(void) - cancelHTTPListener
 Stops listening the loopback interface and sends an cancellation error (in the domain OIDGeneralErrorDomain, with the code OIDErrorCodeProgramCanceledAuthorizationFlow) to the currentAuthorizationFlow. Has no effect if called when no requests are pending. @discussion The HTTP listener is stopped automatically on receiving a valid response (regardless of whether the request succeeded or not), this method should not be called except when abandoning the external user-agent request.
 

Properties

id< OIDExternalUserAgentSessioncurrentAuthorizationFlow
 The external user-agent request flow session which receives the return URL from the browser. @discussion The loopback HTTP server will try sending incoming request URLs to the OAuth redirect handler to continue the flow. This should be set while an external user-agent request flow is in progress.
 

Detailed Description

Start a HTTP server on the loopback interface (i.e. 127.0.0.1) to receive the OAuth response redirects on macOS.

Method Documentation

◆ initWithSuccessURL:()

- (instancetype) initWithSuccessURL: (nullable NSURL *)  successURL

Creates an a loopback HTTP redirect URI handler with the given success URL.

Parameters
successURLThe URL that the user is redirected to after the external user-agent request flow completes either with a result of success or error. The contents of this page should instruct the user to return to the app. @discussion Once you have initiated the external user-agent request, be sure to set currentAuthorizationFlow on this object so that any responses received by this listener will be routed accordingly.

◆ startHTTPListener:()

- (NSURL *) startHTTPListener: (NSError **)  returnError

Starts listening on the loopback interface on a random available port, and returns a URL with the base address. Use the returned redirect URI to build a OIDExternalUserAgentRequest, and once you initiate the request, set the resulting OIDExternalUserAgentSession to currentAuthorizationFlow so the response can be handled.

Parameters
returnErrorThe error if an error occurred while starting the local HTTP server.
Returns
The URL containing the address of the server with the randomly assigned available port. @discussion Each instance of OIDRedirectHTTPHandler can only listen for a single response. Calling this more than once will result in the previous listener being cancelled (equivalent of cancelHTTPListener being called).

◆ startHTTPListener:withPort:()

- (NSURL *) startHTTPListener: (NSError **)  returnError
withPort: (uint16_t)  port 

Starts listening on the loopback interface on a specified port, and returns a URL with the base address. Use the returned redirect URI to build a OIDExternalUserAgentRequest, and once you initiate the request, set the resulting OIDExternalUserAgentSession to currentAuthorizationFlow so the response can be handled.

Parameters
returnErrorThe error if an error occurred while starting the local HTTP server.
portThe manually specified port, or 0 for a random available port.
Returns
The URL containing the address of the server with the specified port, or nil if there was an error. @discussion Each instance of OIDRedirectHTTPHandler can only listen for a single response. Calling this more than once will result in the previous listener being cancelled (equivalent of cancelHTTPListener being called).

The documentation for this class was generated from the following file: