BlackBerryId

Since: class.

#include <bb/platform/identity/BlackBerryId>

To link against this class, add the following line to your .pro file: LIBS += -lbbplatform

Use BlackBerry ID as an identity provider for your application.

Using the BlackBerry ID service as an identity provider, you can enhance your app in several ways:
  • Provide user authentication within your app, without prompting for user credentials.

  • Provide user authorization to access other BlackBerry apps and off-device services without prompting for user credentials.

  • Provide access to users' personal information that is stored in the BlackBerry ID account system. User permission to access this information is required.

Benefits of using BlackBerry ID user authentication:
  • Eliminate the need to build your own username and password management.

  • Automatically sign users in to your app after they sign in with their BlackBerry ID account on their devices. This makes your app easier to use.

  • Eliminate the need for users to create and remember a username and password for your app.

If your app interacts with an off-device service that requires user authentication (for example, a website that requires the user to sign in with a username and password), you can use BlackBerry ID APIs to perform the off-device authentication/authorization using tokens, instead of prompting the user for credentials. Your app and the off-device service interact seamlessly.

You can personalize the user experience of your app by incorporating your users' personal information in your app. Users must allow your app to access the information associated with their BlackBerry ID accounts before you can access it. The application must have the read_personally_identifiable_information permission included in their bar descriptor. The information that is available includes:
  • first name

  • last name

  • screen name

  • username (an email address)

The following sample shows how to retrieve a users first name:

Make sure to include the following header files in your application

#include <bb/platform/identity/IdentityServiceProvide>
#include <bb/platform/identity/IdentityServiceResult>
#include <bb/platform/identity/IdentityServicePropertyResult>
#include <bb/platform/identity/BlackBerryId>
#include <bb/platform/identity/BlackBerryIdPropertyType>

Step 1 - Create an IdentityServiceProvider instance.

IdentityServiceProvider *provider = new IdentityServiceProvider( BlackBerryId::providerName() );
if( !provider->isValid() ) {
        qWarning() << "Unable to communicate with BlackBerryId Provider: " << provider->error();
}

Step 2 - Connect with with success and failure signals.

 QObject::connect( provider, SIGNAL( propertiesRetrieved( int, QMap<QString, QString> ) ),
                    this, SLOT( getPropertiesSucceeded( int, QMap<QString, QString> ) ) );

 QObject::connect( provider, SIGNAL( propertyRetrievalFailed( int, bb::platform::identity::IdentityServicePropertyResult::Type, QString ) ),
                    this, SLOT( getPropertiesFail( int, bb::platform::identity::IdentityServicePropertyResult::Type, QString ) ) );

Step 3 - Call API's

IdentityServiceResult::Type result = provider->requestProperties( BlackBerryIdPropertyType::Core,
                                                                        BlackBerryId::firstNamePropertyKey() );
if( result != IdentityServiceResult::Success ){
    qWarning << "Unable to retrieve first name: " << result;
}


Overview

Public Functions Index

BlackBerryId (QObject *parent=0)
virtual ~BlackBerryId ()

Properties

QString emailPropertyKey[read-only]

The key used to access a user's Validated email.

QString firstNamePropertyKey[read-only]

The key used to access a user's FirstName.

QString lastNamePropertyKey[read-only]

The key used to access a user's LastName.

QString providerName[read-only]

The identity provider name of BlackBerry ID to use with the.

See also:

IdentityServiceProvider class.

QString screenNamePropertyKey[read-only]

The key used to access a user's ScreenName.

QString uniqueIdPropertyKey[read-only]

The key used to access a user's Unique Id.

QString userNamePropertyKey[read-only]

The key used to access a user's UserName.

Public Functions

BlackBerryId (

Constructs an empty BlackBerryId instance.

Parameters
parent

The parent object. Setting parent to 0 constructs an BlackBerryId instance with no parent.

virtual~BlackBerryId ()

Destructor.

Static Public Functions

QString emailPropertyKey ()

The key used to access a user's Confirmed Email.

Return:

The key to use in requestProperties when requesting the user's confirmed email address.

QString firstNamePropertyKey ()

The key used to access a user's FirstName.

Return:

The key to use in requestProperties when requesting the user's FirstName.

QString lastNamePropertyKey ()

The key used to access a user's LastName.

Return:

The key to use in requestProperties when requesting the user's LastName.

QString providerName ()

The identity provider name of BlackBerry ID to use with the.

See also:

IdentityServiceProvider class.

Return:

The string name of the BlackBerry ID provider.

QString screenNamePropertyKey ()

The key used to access a user's ScreenName.

Return:

The key to use in requestProperties when requesting the user's ScreenName.

QString uniqueIdPropertyKey ()

The key used to access a user's Unique Id.

Return:

The key to use in requestProperties when requesting the user's Unique Id.

QString userNamePropertyKey ()

BlackBerry ID core properties.

These are the core properties that are available to applications using BlackBerry ID as an identity provider.
See also:

requestProperties() with the BBID_PROPERTY_CORE type.

The key used to access a user's UserName.
Return:

The key to use in requestProperties when requesting the user's UserName.

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus