VOCredential
@interface VOCredential : NSObject
VOCredential
is used to pass credentials to the Vouchr Server when logging in and
authenticating VOUser
s.
-
The name of the network. This should be the same for each unique login type. A network name will be provided for each login service.
Declaration
Objective-C
@property (readonly, strong, atomic) NSString *_Nonnull network;
Swift
var network: String { get }
-
The id of the
VOUser
logging in with a network. This can be a userId, email address, etc. Something unique to identify the user.Declaration
Objective-C
@property (readonly, strong, atomic) NSString *_Nonnull networkId;
Swift
var networkId: String { get }
-
The access token of the logging in
VOUser
.Declaration
Objective-C
@property (readonly, strong, atomic) NSString *_Nonnull accessToken;
Swift
var accessToken: String { get }
-
A JWT Token to authenticate a user using Open Auth.
Declaration
Objective-C
@property (readonly, strong, atomic) NSString *_Nonnull idToken;
Swift
var idToken: String { get }
-
Default initializer to create a
VOCredential
.Declaration
Objective-C
- (nonnull instancetype)initWithNetworkId:(nonnull NSString *)networkId network:(nonnull NSString *)network accessToken:(nonnull NSString *)accessToken;
Swift
init(networkId: String, network: String, accessToken: String)
Parameters
networkId
- The unique identifier for the
VOUser
.network
- The name of the network.
accessToken
- The access token for the
VOUser
.Return Value
instance of
VOCredential
. -
Alternative initializer using a dictionary to create the
VOCredential
. Looks for ‘network’, ‘accessToken’, ‘networkId’ and ‘idToken’ inside the dictionary.Declaration
Objective-C
- (nonnull instancetype)initWithDictionary:(nonnull NSDictionary *)dictionary;
Swift
init(dictionary: [AnyHashable : Any])
Parameters
dictionary
- The dictionary of properties to create a
VOCredential
Return Value
instance of
VOCredential
. -
Static initializer to create a
VOCredential
with a dictionary. Internally callsinitWithDictionary
.Declaration
Objective-C
+ (nonnull instancetype)credentialWithDictionary: (nonnull NSDictionary *)dictionary;
Parameters
dictionary
- The dictionary of properties to create a
VOCredential
Return Value
instance of
VOCredential
. -
Static initializer to create a
VOCredential
with a networkId, network and accessToken. Internally callsinitWithNetworkId:network:accessToken
.Declaration
Objective-C
+ (nonnull instancetype)credentialWithNetworkId:(nonnull NSString *)networkId network:(nonnull NSString *)network accessToken:(nonnull NSString *)accessToken;
Parameters
networkId
- The unique identifier for the
VOUser
.network
- The name of the network.
accessToken
- The access token for the
VOUser
.Return Value
instance of
VOCredential
. -
Converts a
VOCredential
Object to an NSDictionary that can be used for caching or sending JSON to a server.Declaration
Objective-C
- (nonnull NSDictionary *)dictionaryRepresentation;
Swift
func dictionaryRepresentation() -> [AnyHashable : Any]
Return Value
dictionary - Dictionary form of a
VOCredential
.