platform 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +21 -0
- data/.rspec +2 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +191 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +5 -0
- data/Rakefile +37 -0
- data/app/assets/images/platform/.gitkeep +0 -0
- data/app/assets/images/platform/accept.png +0 -0
- data/app/assets/images/platform/action_tab_bkgd.gif +0 -0
- data/app/assets/images/platform/action_tab_white_bkgd.gif +0 -0
- data/app/assets/images/platform/add.png +0 -0
- data/app/assets/images/platform/apps/app_icon.gif +0 -0
- data/app/assets/images/platform/apps/app_logo.gif +0 -0
- data/app/assets/images/platform/arrow_down.gif +0 -0
- data/app/assets/images/platform/arrow_down.png +0 -0
- data/app/assets/images/platform/arrow_down_grey.png +0 -0
- data/app/assets/images/platform/arrow_right.gif +0 -0
- data/app/assets/images/platform/arrow_up.png +0 -0
- data/app/assets/images/platform/arrow_up_grey.png +0 -0
- data/app/assets/images/platform/bullet_go.png +0 -0
- data/app/assets/images/platform/buttons.png +0 -0
- data/app/assets/images/platform/cancel.png +0 -0
- data/app/assets/images/platform/clipboard_icon.gif +0 -0
- data/app/assets/images/platform/close.gif +0 -0
- data/app/assets/images/platform/cross.png +0 -0
- data/app/assets/images/platform/default_app_icon.gif +0 -0
- data/app/assets/images/platform/default_app_logo.gif +0 -0
- data/app/assets/images/platform/delete.png +0 -0
- data/app/assets/images/platform/disk.png +0 -0
- data/app/assets/images/platform/exclamation.png +0 -0
- data/app/assets/images/platform/eye.png +0 -0
- data/app/assets/images/platform/eye_not.png +0 -0
- data/app/assets/images/platform/field_sprite.gif +0 -0
- data/app/assets/images/platform/find.png +0 -0
- data/app/assets/images/platform/globe.gif +0 -0
- data/app/assets/images/platform/help.png +0 -0
- data/app/assets/images/platform/help/app_reg.png +0 -0
- data/app/assets/images/platform/help/app_reg_ext.png +0 -0
- data/app/assets/images/platform/help/app_reg_web.png +0 -0
- data/app/assets/images/platform/help/auth_desktop.png +0 -0
- data/app/assets/images/platform/help/auth_iframe.png +0 -0
- data/app/assets/images/platform/help/auth_iphone.png +0 -0
- data/app/assets/images/platform/help/auth_web.png +0 -0
- data/app/assets/images/platform/help/authorize.png +0 -0
- data/app/assets/images/platform/help/ext.png +0 -0
- data/app/assets/images/platform/help/login.png +0 -0
- data/app/assets/images/platform/help/login_desktop.png +0 -0
- data/app/assets/images/platform/help/login_iphone.png +0 -0
- data/app/assets/images/platform/help/login_web.png +0 -0
- data/app/assets/images/platform/help2.png +0 -0
- data/app/assets/images/platform/information.png +0 -0
- data/app/assets/images/platform/keyboard.png +0 -0
- data/app/assets/images/platform/language_selector_arrow.gif +0 -0
- data/app/assets/images/platform/left_quote.png +0 -0
- data/app/assets/images/platform/lightning.png +0 -0
- data/app/assets/images/platform/loading.gif +0 -0
- data/app/assets/images/platform/loading2.gif +0 -0
- data/app/assets/images/platform/loading3.gif +0 -0
- data/app/assets/images/platform/loading_animation.gif +0 -0
- data/app/assets/images/platform/loading_large.gif +0 -0
- data/app/assets/images/platform/lock.png +0 -0
- data/app/assets/images/platform/lock_add.png +0 -0
- data/app/assets/images/platform/lock_delete.png +0 -0
- data/app/assets/images/platform/lock_open.png +0 -0
- data/app/assets/images/platform/medals/bronze.png +0 -0
- data/app/assets/images/platform/medals/gold.png +0 -0
- data/app/assets/images/platform/medals/runner.png +0 -0
- data/app/assets/images/platform/medals/silver.png +0 -0
- data/app/assets/images/platform/minus_node.png +0 -0
- data/app/assets/images/platform/oauth/perm_tile.gif +0 -0
- data/app/assets/images/platform/oauth/right_grey.png +0 -0
- data/app/assets/images/platform/pencil.png +0 -0
- data/app/assets/images/platform/photo_silhouette.gif +0 -0
- data/app/assets/images/platform/pixel.gif +0 -0
- data/app/assets/images/platform/platform.png +0 -0
- data/app/assets/images/platform/platform2.png +0 -0
- data/app/assets/images/platform/platform3.png +0 -0
- data/app/assets/images/platform/platform4.png +0 -0
- data/app/assets/images/platform/platform5.png +0 -0
- data/app/assets/images/platform/plus.png +0 -0
- data/app/assets/images/platform/plus_node.png +0 -0
- data/app/assets/images/platform/random.png +0 -0
- data/app/assets/images/platform/random2.png +0 -0
- data/app/assets/images/platform/rating_star0.png +0 -0
- data/app/assets/images/platform/rating_star05.png +0 -0
- data/app/assets/images/platform/rating_star1.png +0 -0
- data/app/assets/images/platform/rating_stars.gif +0 -0
- data/app/assets/images/platform/rating_stars.psd +0 -0
- data/app/assets/images/platform/reply.png +0 -0
- data/app/assets/images/platform/right_quote.png +0 -0
- data/app/assets/images/platform/rotating_world.gif +0 -0
- data/app/assets/images/platform/script.png +0 -0
- data/app/assets/images/platform/script_edit.png +0 -0
- data/app/assets/images/platform/script_gear.png +0 -0
- data/app/assets/images/platform/site_sprite.gif +0 -0
- data/app/assets/images/platform/spinner.gif +0 -0
- data/app/assets/images/platform/star.png +0 -0
- data/app/assets/images/platform/table_edit.png +0 -0
- data/app/assets/images/platform/table_gear.png +0 -0
- data/app/assets/images/platform/table_multiple.png +0 -0
- data/app/assets/images/platform/thumb_down.png +0 -0
- data/app/assets/images/platform/thumb_up.png +0 -0
- data/app/assets/images/platform/top_left_stem.png +0 -0
- data/app/assets/images/platform/top_right_stem.png +0 -0
- data/app/assets/images/platform/translate_icn.gif +0 -0
- data/app/assets/images/platform/treeview/diffDoc.gif +0 -0
- data/app/assets/images/platform/treeview/diffFolder.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2blank.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2doc.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2folderclosed.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2folderopen.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2lastnode.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2link.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2mlastnode.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2mnode.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2node.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2plastnode.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2pnode.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2vertline.gif +0 -0
- data/app/assets/images/platform/wizard.png +0 -0
- data/app/assets/images/platform/world_link.png +0 -0
- data/app/assets/javascripts/platform/api_explorer.js +628 -0
- data/app/assets/javascripts/platform/application.js +9 -0
- data/app/assets/javascripts/platform/ftiens4.js +1197 -0
- data/app/assets/javascripts/platform/jsdk.js +539 -0
- data/app/assets/javascripts/platform/platform.js +447 -0
- data/app/assets/javascripts/platform/shortcut.js +223 -0
- data/app/assets/javascripts/platform/ua.js +147 -0
- data/app/assets/stylesheets/platform/api_explorer.css.scss +140 -0
- data/app/assets/stylesheets/platform/application.css.scss +6 -0
- data/app/assets/stylesheets/platform/components.css.scss +208 -0
- data/app/assets/stylesheets/platform/layout.css.scss +119 -0
- data/app/assets/stylesheets/platform/oauth.css +51 -0
- data/app/assets/stylesheets/platform/platform.css.scss +311 -0
- data/app/controllers/platform/admin/apps_controller.rb +99 -0
- data/app/controllers/platform/admin/base_controller.rb +60 -0
- data/app/controllers/platform/admin/categories_controller.rb +132 -0
- data/app/controllers/platform/admin/clientsdk_controller.rb +30 -0
- data/app/controllers/platform/admin/developers_controller.rb +30 -0
- data/app/controllers/platform/admin/exceptions_controller.rb +30 -0
- data/app/controllers/platform/admin/forum_controller.rb +34 -0
- data/app/controllers/platform/admin/metrics_controller.rb +42 -0
- data/app/controllers/platform/api/apps_controller.rb +40 -0
- data/app/controllers/platform/api/base_controller.rb +541 -0
- data/app/controllers/platform/apps_controller.rb +142 -0
- data/app/controllers/platform/base_controller.rb +127 -0
- data/app/controllers/platform/developer/api_explorer_controller.rb +56 -0
- data/app/controllers/platform/developer/apps_controller.rb +161 -0
- data/app/controllers/platform/developer/base_controller.rb +51 -0
- data/app/controllers/platform/developer/blog_controller.rb +29 -0
- data/app/controllers/platform/developer/dashboard_controller.rb +63 -0
- data/app/controllers/platform/developer/forum_controller.rb +85 -0
- data/app/controllers/platform/developer/help_controller.rb +113 -0
- data/app/controllers/platform/developer/info_controller.rb +41 -0
- data/app/controllers/platform/developer/registration_controller.rb +39 -0
- data/app/controllers/platform/developer/resources_controller.rb +30 -0
- data/app/controllers/platform/forum_controller.rb +74 -0
- data/app/controllers/platform/oauth_controller.rb +421 -0
- data/app/controllers/platform/ratings_controller.rb +61 -0
- data/app/helpers/platform/admin/categories_helper.rb +54 -0
- data/app/helpers/platform/apps_helper.rb +26 -0
- data/app/helpers/platform/developer/dashboard_helper.rb +42 -0
- data/app/helpers/platform/developer/help_helper.rb +45 -0
- data/app/helpers/platform_helper.rb +26 -0
- data/app/models/platform/application.rb +394 -0
- data/app/models/platform/application_category.rb +34 -0
- data/app/models/platform/application_developer.rb +30 -0
- data/app/models/platform/application_filter.rb +30 -0
- data/app/models/platform/application_log.rb +32 -0
- data/app/models/platform/application_log_filter.rb +34 -0
- data/app/models/platform/application_metric.rb +58 -0
- data/app/models/platform/application_metric_filter.rb +34 -0
- data/app/models/platform/application_permission.rb +30 -0
- data/app/models/platform/application_permission_filter.rb +30 -0
- data/app/models/platform/application_usage_metric.rb +58 -0
- data/app/models/platform/application_usage_metric_filter.rb +34 -0
- data/app/models/platform/application_user.rb +45 -0
- data/app/models/platform/application_user_filter.rb +34 -0
- data/app/models/platform/base_filter.rb +46 -0
- data/app/models/platform/category.rb +64 -0
- data/app/models/platform/daily_application_metric.rb +31 -0
- data/app/models/platform/developer.rb +45 -0
- data/app/models/platform/developer_filter.rb +26 -0
- data/app/models/platform/forum_message.rb +35 -0
- data/app/models/platform/forum_message_filter.rb +26 -0
- data/app/models/platform/forum_topic.rb +38 -0
- data/app/models/platform/forum_topic_filter.rb +26 -0
- data/app/models/platform/logged_exception.rb +290 -0
- data/app/models/platform/logged_exception_filter.rb +58 -0
- data/app/models/platform/media/image.rb +26 -0
- data/app/models/platform/media/media.rb +58 -0
- data/app/models/platform/monthly_application_metric.rb +31 -0
- data/app/models/platform/oauth/access_token.rb +57 -0
- data/app/models/platform/oauth/client_token.rb +38 -0
- data/app/models/platform/oauth/oauth_model_methods.rb +41 -0
- data/app/models/platform/oauth/oauth_token.rb +57 -0
- data/app/models/platform/oauth/oauth_token_filter.rb +34 -0
- data/app/models/platform/oauth/refresh_token.rb +47 -0
- data/app/models/platform/oauth/request_token.rb +50 -0
- data/app/models/platform/permission.rb +27 -0
- data/app/models/platform/rating.rb +43 -0
- data/app/models/platform/rating_filter.rb +30 -0
- data/app/models/platform/rollup_log.rb +27 -0
- data/app/models/platform/rollup_log_filter.rb +30 -0
- data/app/models/platform/total_application_metric.rb +40 -0
- data/app/models/platform/weekly_application_metric.rb +31 -0
- data/app/views/platform/admin/apps/_categories.html.erb +17 -0
- data/app/views/platform/admin/apps/_categories_scripts.html.erb +17 -0
- data/app/views/platform/admin/apps/_tabs.html.erb +25 -0
- data/app/views/platform/admin/apps/index.html.erb +32 -0
- data/app/views/platform/admin/apps/permissions.html.erb +7 -0
- data/app/views/platform/admin/apps/ratings.html.erb +7 -0
- data/app/views/platform/admin/apps/tokens.html.erb +18 -0
- data/app/views/platform/admin/apps/users.html.erb +7 -0
- data/app/views/platform/admin/apps/view.html.erb +170 -0
- data/app/views/platform/admin/categories/_tabs.html.erb +22 -0
- data/app/views/platform/admin/categories/category_assigner.html.erb +9 -0
- data/app/views/platform/admin/categories/category_assigner_tree.html.erb +81 -0
- data/app/views/platform/admin/categories/index.html.erb +106 -0
- data/app/views/platform/admin/categories/items.html.erb +153 -0
- data/app/views/platform/admin/categories/lb_update_application_category.html.erb +54 -0
- data/app/views/platform/admin/categories/lb_update_category.html.erb +64 -0
- data/app/views/platform/admin/categories/tree.html.erb +64 -0
- data/app/views/platform/admin/clientsdk/index.html.erb +89 -0
- data/app/views/platform/admin/common/_footer.html.erb +1 -0
- data/app/views/platform/admin/common/_header.html.erb +32 -0
- data/app/views/platform/admin/common/_lightbox_buttons.html.erb +5 -0
- data/app/views/platform/admin/common/_paginator.html.erb +20 -0
- data/app/views/platform/admin/developers/_tabs.html.erb +22 -0
- data/app/views/platform/admin/developers/index.html.erb +7 -0
- data/app/views/platform/admin/exceptions/_tabs.html.erb +22 -0
- data/app/views/platform/admin/exceptions/index.html.erb +7 -0
- data/app/views/platform/admin/forum/_tabs.html.erb +22 -0
- data/app/views/platform/admin/forum/index.html.erb +7 -0
- data/app/views/platform/admin/forum/messages.html.erb +7 -0
- data/app/views/platform/admin/metrics/_tabs.html.erb +25 -0
- data/app/views/platform/admin/metrics/application_log.html.erb +7 -0
- data/app/views/platform/admin/metrics/index.html.erb +9 -0
- data/app/views/platform/admin/metrics/rollup_log.html.erb +7 -0
- data/app/views/platform/admin/metrics/usage.html.erb +7 -0
- data/app/views/platform/apps/_actions_module.html.erb +3 -0
- data/app/views/platform/apps/_app_footer.html.erb +8 -0
- data/app/views/platform/apps/_app_header.html.erb +25 -0
- data/app/views/platform/apps/_apps_module.html.erb +42 -0
- data/app/views/platform/apps/_authorize_form.html.erb +11 -0
- data/app/views/platform/apps/_categories_module.html.erb +11 -0
- data/app/views/platform/apps/_featured_apps_module.html.erb +40 -0
- data/app/views/platform/apps/_left.html.erb +20 -0
- data/app/views/platform/apps/_monthly_users_module.html.erb +8 -0
- data/app/views/platform/apps/_paginator.html.erb +13 -0
- data/app/views/platform/apps/_rank_module.html.erb +18 -0
- data/app/views/platform/apps/_search_apps_module.html.erb +35 -0
- data/app/views/platform/apps/canvas_app.html.erb +15 -0
- data/app/views/platform/apps/index.html.erb +86 -0
- data/app/views/platform/apps/view.html.erb +71 -0
- data/app/views/platform/apps/xd.html.erb +11 -0
- data/app/views/platform/common/_footer.html.erb +1 -0
- data/app/views/platform/common/_header.html.erb +4 -0
- data/app/views/platform/common/_paginator.html.erb +32 -0
- data/app/views/platform/common/_scripts.html.erb +7 -0
- data/app/views/platform/common/_user_login.html.erb +11 -0
- data/app/views/platform/developer/api_explorer/history.html.erb +31 -0
- data/app/views/platform/developer/api_explorer/index.html.erb +134 -0
- data/app/views/platform/developer/api_explorer/oauth_lander.html.erb +4 -0
- data/app/views/platform/developer/api_explorer/options.html.erb +44 -0
- data/app/views/platform/developer/apps/_form.html.erb +340 -0
- data/app/views/platform/developer/apps/create_version.html.erb +19 -0
- data/app/views/platform/developer/apps/edit.html.erb +21 -0
- data/app/views/platform/developer/apps/index.html.erb +375 -0
- data/app/views/platform/developer/apps/new.html.erb +20 -0
- data/app/views/platform/developer/blog/index.html.erb +7 -0
- data/app/views/platform/developer/common/_footer.html.erb +1 -0
- data/app/views/platform/developer/common/_header.html.erb +34 -0
- data/app/views/platform/developer/dashboard/_apps_info.html.erb +84 -0
- data/app/views/platform/developer/dashboard/_discussions.html.erb +68 -0
- data/app/views/platform/developer/dashboard/_header.html.erb +12 -0
- data/app/views/platform/developer/dashboard/_reviews.html.erb +53 -0
- data/app/views/platform/developer/dashboard/_statistics.html.erb +105 -0
- data/app/views/platform/developer/dashboard/index.html.erb +85 -0
- data/app/views/platform/developer/dashboard/settings.html.erb +23 -0
- data/app/views/platform/developer/forum/_message.html.erb +17 -0
- data/app/views/platform/developer/forum/_messages.html.erb +14 -0
- data/app/views/platform/developer/forum/_new_message.html.erb +28 -0
- data/app/views/platform/developer/forum/_new_topic.html.erb +39 -0
- data/app/views/platform/developer/forum/index.html.erb +89 -0
- data/app/views/platform/developer/forum/topic.html.erb +28 -0
- data/app/views/platform/developer/help/_footer.html.erb +4 -0
- data/app/views/platform/developer/help/_header.html.erb +95 -0
- data/app/views/platform/developer/help/_navigation.html.erb +99 -0
- data/app/views/platform/developer/help/api.html.erb +120 -0
- data/app/views/platform/developer/help/credits.html.erb +77 -0
- data/app/views/platform/developer/help/index.html.erb +19 -0
- data/app/views/platform/developer/help/license.html.erb +586 -0
- data/app/views/platform/developer/help/oauth_app_login.html.erb +177 -0
- data/app/views/platform/developer/help/oauth_client_side.html.erb +264 -0
- data/app/views/platform/developer/help/oauth_desktop.html.erb +191 -0
- data/app/views/platform/developer/help/oauth_extensions.html.erb +342 -0
- data/app/views/platform/developer/help/oauth_intro.html.erb +371 -0
- data/app/views/platform/developer/help/oauth_mobile.html.erb +292 -0
- data/app/views/platform/developer/help/oauth_server_side.html.erb +603 -0
- data/app/views/platform/developer/help/oauth_trusted_client.html.erb +202 -0
- data/app/views/platform/developer/help/reference.html.erb +42 -0
- data/app/views/platform/developer/help/sdk_ios.html.erb +31 -0
- data/app/views/platform/developer/help/sdk_js.html.erb +202 -0
- data/app/views/platform/developer/info/_basic_info.html.erb +74 -0
- data/app/views/platform/developer/info/_header.html.erb +12 -0
- data/app/views/platform/developer/info/index.html.erb +23 -0
- data/app/views/platform/developer/registration/index.html.erb +134 -0
- data/app/views/platform/developer/resources/index.html.erb +23 -0
- data/app/views/platform/forum/_message.html.erb +17 -0
- data/app/views/platform/forum/_messages.html.erb +14 -0
- data/app/views/platform/forum/_new_message.html.erb +26 -0
- data/app/views/platform/forum/_new_topic.html.erb +38 -0
- data/app/views/platform/forum/_topic.html.erb +18 -0
- data/app/views/platform/forum/_topics.html.erb +74 -0
- data/app/views/platform/login/index.html.erb +31 -0
- data/app/views/platform/login/register.html.erb +55 -0
- data/app/views/platform/oauth/_authorization_box.html.erb +75 -0
- data/app/views/platform/oauth/_authorization_popup.html.erb +38 -0
- data/app/views/platform/oauth/_authorize_form.html.erb +11 -0
- data/app/views/platform/oauth/auth_failed.html.erb +0 -0
- data/app/views/platform/oauth/auth_success.html.erb +0 -0
- data/app/views/platform/oauth/authorize_desktop.html.erb +76 -0
- data/app/views/platform/oauth/authorize_failure_iframe.html.erb +1 -0
- data/app/views/platform/oauth/authorize_failure_mobile.html.erb +24 -0
- data/app/views/platform/oauth/authorize_failure_popup.html.erb +24 -0
- data/app/views/platform/oauth/authorize_failure_web.html.erb +1 -0
- data/app/views/platform/oauth/authorize_iframe.html.erb +16 -0
- data/app/views/platform/oauth/authorize_mobile.html.erb +1 -0
- data/app/views/platform/oauth/authorize_popup.html.erb +1 -0
- data/app/views/platform/oauth/authorize_success_iframe.html.erb +1 -0
- data/app/views/platform/oauth/authorize_success_mobile.html.erb +24 -0
- data/app/views/platform/oauth/authorize_success_popup.html.erb +24 -0
- data/app/views/platform/oauth/authorize_success_web.html.erb +1 -0
- data/app/views/platform/oauth/authorize_web.html.erb +3 -0
- data/app/views/platform/oauth/xd.html.erb +13 -0
- data/app/views/platform/ratings/_list.html.erb +30 -0
- data/app/views/platform/ratings/_new.html.erb +70 -0
- data/app/views/platform/ratings/_rating.html.erb +17 -0
- data/config/platform/config.yml +133 -0
- data/config/platform/data/default_applications.yml +39 -0
- data/config/platform/data/default_categories.yml +56 -0
- data/config/platform/data/default_permissions.yml +0 -0
- data/config/platform/site/features.yml +66 -0
- data/config/routes.rb +59 -0
- data/db/migrate/20110602232141_create_platform_tables.rb +262 -0
- data/docs/Classes.graffle +7315 -0
- data/docs/Classes.pdf +0 -0
- data/lib/generators/platform/platform_generator.rb +56 -0
- data/lib/generators/platform/templates/db/create_platform_tables.rb +262 -0
- data/lib/generators/platform/templates/layouts/platform.html.erb +49 -0
- data/lib/generators/platform/templates/layouts/platform_admin.html.erb +60 -0
- data/lib/platform.rb +6 -0
- data/lib/platform/api/already_jsoned_string.rb +9 -0
- data/lib/platform/api/proxy.rb +45 -0
- data/lib/platform/api/proxy/base.rb +62 -0
- data/lib/platform/cache.rb +78 -0
- data/lib/platform/config.rb +666 -0
- data/lib/platform/engine.rb +5 -0
- data/lib/platform/exception.rb +27 -0
- data/lib/platform/extensions/action_controller_extension.rb +65 -0
- data/lib/platform/extensions/action_view_extension.rb +168 -0
- data/lib/platform/extensions/object_extension.rb +51 -0
- data/lib/platform/helper.rb +33 -0
- data/lib/platform/logger.rb +62 -0
- data/lib/platform/railtie.rb +52 -0
- data/lib/platform/random_password_generator.rb +76 -0
- data/lib/platform/simple_string_permissions.rb +40 -0
- data/lib/platform/version.rb +3 -0
- data/lib/tasks/platform.rake +119 -0
- data/platform.gemspec +45 -0
- data/script/rails +6 -0
- data/spec/config/config_spec.rb +10 -0
- data/spec/dummy_app.rb +52 -0
- data/spec/models/application_spec.rb +53 -0
- data/spec/models/developer_spec.rb +23 -0
- data/spec/spec_helper.rb +29 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +7 -0
- data/test/dummy/app/assets/stylesheets/admin.css +200 -0
- data/test/dummy/app/assets/stylesheets/application.css +47 -0
- data/test/dummy/app/assets/stylesheets/components.css.scss +211 -0
- data/test/dummy/app/assets/stylesheets/layout.css.scss +143 -0
- data/test/dummy/app/controllers/admin/admins_controller.rb +7 -0
- data/test/dummy/app/controllers/admin/base_controller.rb +12 -0
- data/test/dummy/app/controllers/admin/bookmarks_controller.rb +7 -0
- data/test/dummy/app/controllers/admin/users_controller.rb +19 -0
- data/test/dummy/app/controllers/api/base_controller.rb +5 -0
- data/test/dummy/app/controllers/api/bookmarks_controller.rb +35 -0
- data/test/dummy/app/controllers/api/users_controller.rb +19 -0
- data/test/dummy/app/controllers/application_controller.rb +31 -0
- data/test/dummy/app/controllers/home_controller.rb +7 -0
- data/test/dummy/app/controllers/login_controller.rb +65 -0
- data/test/dummy/app/helpers/application_helper.rb +9 -0
- data/test/dummy/app/helpers/home_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/models/admin.rb +4 -0
- data/test/dummy/app/models/admin_filter.rb +7 -0
- data/test/dummy/app/models/bookmark.rb +7 -0
- data/test/dummy/app/models/user.rb +34 -0
- data/test/dummy/app/views/admin/admins/index.html.erb +7 -0
- data/test/dummy/app/views/admin/bookmarks/index.html.erb +5 -0
- data/test/dummy/app/views/admin/users/index.html.erb +10 -0
- data/test/dummy/app/views/demo/index.rhtml +108 -0
- data/test/dummy/app/views/demo/tokens.rhtml +35 -0
- data/test/dummy/app/views/home/index.html.erb +43 -0
- data/test/dummy/app/views/layouts/_footer.html.erb +16 -0
- data/test/dummy/app/views/layouts/_header.html.erb +22 -0
- data/test/dummy/app/views/layouts/admin.html.erb +97 -0
- data/test/dummy/app/views/layouts/application.html.erb +25 -0
- data/test/dummy/app/views/layouts/minimal.html.erb +37 -0
- data/test/dummy/app/views/layouts/popup.html.erb +43 -0
- data/test/dummy/app/views/login/index.html.erb +34 -0
- data/test/dummy/app/views/login/register.html.erb +51 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +51 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +30 -0
- data/test/dummy/config/environments/production.rb +60 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/platform/api/0/bookmark.yml +18 -0
- data/test/dummy/config/platform/api/0/user.yml +17 -0
- data/test/dummy/config/platform/api/1/bookmark.yml +58 -0
- data/test/dummy/config/platform/api/1/user.yml +36 -0
- data/test/dummy/config/platform/config.yml +135 -0
- data/test/dummy/config/platform/data/default_applications.yml +39 -0
- data/test/dummy/config/platform/data/default_categories.yml +56 -0
- data/test/dummy/config/platform/data/default_permissions.yml +0 -0
- data/test/dummy/config/platform/site/features.yml +66 -0
- data/test/dummy/config/platform/site/sample_apps.yml +100 -0
- data/test/dummy/config/routes.rb +30 -0
- data/test/dummy/config/tr8n/config.yml +247 -0
- data/test/dummy/config/tr8n/data/ip_locations.csv +93460 -0
- data/test/dummy/config/tr8n/rules/default_date_rules.yml +20 -0
- data/test/dummy/config/tr8n/rules/default_gender_list_rules.yml +82 -0
- data/test/dummy/config/tr8n/rules/default_gender_rules.yml +20 -0
- data/test/dummy/config/tr8n/rules/default_language_cases.yml +272 -0
- data/test/dummy/config/tr8n/rules/default_list_rules.yml +19 -0
- data/test/dummy/config/tr8n/rules/default_numeric_rules.yml +42 -0
- data/test/dummy/config/tr8n/rules/default_value_rules.yml +18 -0
- data/test/dummy/config/tr8n/site/default_glossary.yml +18 -0
- data/test/dummy/config/tr8n/site/default_languages.yml +1591 -0
- data/test/dummy/config/tr8n/site/features.yml +111 -0
- data/test/dummy/config/tr8n/site/shortcuts.yml +55 -0
- data/test/dummy/config/tr8n/site/sitemap.json +42 -0
- data/test/dummy/config/tr8n/tokens/data.yml +19 -0
- data/test/dummy/config/tr8n/tokens/decorations.yml +19 -0
- data/test/dummy/config/will_filter/config.yml +99 -0
- data/test/dummy/db/migrate/20101207014543_create_users.rb +23 -0
- data/test/dummy/db/migrate/20110113223509_create_admins.rb +15 -0
- data/test/dummy/db/migrate/20110930041143_create_will_filter_filters.rb +15 -0
- data/test/dummy/db/migrate/20110930041150_create_tr8n_tables.rb +350 -0
- data/test/dummy/db/migrate/20111004075531_create_platform_tables.rb +262 -0
- data/test/dummy/db/migrate/20111012055603_create_bookmarks.rb +10 -0
- data/test/dummy/db/schema.rb +683 -0
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/lib/platform/api/bookmark_proxy_0.rb +12 -0
- data/test/dummy/lib/platform/api/bookmark_proxy_1.rb +12 -0
- data/test/dummy/lib/platform/api/user_proxy_0.rb +12 -0
- data/test/dummy/lib/platform/api/user_proxy_1.rb +12 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/documents.yml +11 -0
- data/test/dummy/test/unit/document_test.rb +7 -0
- metadata +886 -0
@@ -0,0 +1,292 @@
|
|
1
|
+
<%= render :partial => "header" %>
|
2
|
+
<div class="documentation_section_title">
|
3
|
+
<%= tr("Mobile Application Authorization Flow") %>
|
4
|
+
</div>
|
5
|
+
<div class="documentation_section">
|
6
|
+
<p>
|
7
|
+
<%=tr("Mobile authentication/authorization flow is very similar to the client-side flow, but it has a slightly different mechanism for handling the response data.") %>
|
8
|
+
<%=tr("This document provides details no how to integrate Geni into an iPhone application.") %>
|
9
|
+
<%=tr("Android and other mobile devices will work in a similar fashion.") %>
|
10
|
+
</p>
|
11
|
+
<h2><%=tr("Authentication & Authorization") %></h2>
|
12
|
+
<p>
|
13
|
+
<%=tr("To enter the authentication/authorization mobile flow, launch a browser from your mobile application and pass the following parameters to the authorization url:") %>
|
14
|
+
</p>
|
15
|
+
<h3><%=tr("Oauth URL") %></h3>
|
16
|
+
<div class="code_snippet">
|
17
|
+
https://<%=Platform::Config.site_base_url %>/platform/oauth/authorize
|
18
|
+
</div>
|
19
|
+
<h3><%=tr("Parameters") %></h3>
|
20
|
+
<p>
|
21
|
+
<table class="documentation_table">
|
22
|
+
<tr>
|
23
|
+
<th style="width:150px;">
|
24
|
+
<%=tr("Name") %>
|
25
|
+
</th>
|
26
|
+
<th>
|
27
|
+
<%=tr("Description") %>
|
28
|
+
</th>
|
29
|
+
<th style="width:150px;">
|
30
|
+
<%=tr("Required") %>
|
31
|
+
</th>
|
32
|
+
</tr>
|
33
|
+
<tr>
|
34
|
+
<td>
|
35
|
+
client_id
|
36
|
+
</td>
|
37
|
+
<td>
|
38
|
+
<%=tr("Application key generated during the app registration.") %>
|
39
|
+
</td>
|
40
|
+
<td>
|
41
|
+
true
|
42
|
+
</td>
|
43
|
+
</tr>
|
44
|
+
<tr>
|
45
|
+
<td>
|
46
|
+
redirect_uri
|
47
|
+
</td>
|
48
|
+
<td>
|
49
|
+
<%=tr("URL that the user's browser will be redirected back to once app authorization is completed.")%>
|
50
|
+
<%=tr("You can specify a custom URL that will be recognized by your mobile device, which launch your application.")%>
|
51
|
+
</td>
|
52
|
+
<td>
|
53
|
+
true
|
54
|
+
</td>
|
55
|
+
</tr>
|
56
|
+
<tr>
|
57
|
+
<td>
|
58
|
+
response_type
|
59
|
+
</td>
|
60
|
+
<td>
|
61
|
+
<%=tr("For the mobile flow the response type should be set to \"token\".")%>
|
62
|
+
</td>
|
63
|
+
<td>
|
64
|
+
true
|
65
|
+
</td>
|
66
|
+
</tr>
|
67
|
+
<tr>
|
68
|
+
<td>
|
69
|
+
display
|
70
|
+
</td>
|
71
|
+
<td>
|
72
|
+
<%=tr("For the mobile flow the display parameter should be set to \"mobile\".")%>
|
73
|
+
</td>
|
74
|
+
<td>
|
75
|
+
true
|
76
|
+
</td>
|
77
|
+
</tr>
|
78
|
+
<tr>
|
79
|
+
<td>
|
80
|
+
scope
|
81
|
+
</td>
|
82
|
+
<td>
|
83
|
+
<%=tr("A comma delimited list of permissions that the application needs.") %>
|
84
|
+
<%=tr("By default the scope is set to a full data access.") %>
|
85
|
+
<%=tr("This is subject to change in the upcoming releases.") %>
|
86
|
+
</td>
|
87
|
+
<td>
|
88
|
+
false
|
89
|
+
</td>
|
90
|
+
</tr>
|
91
|
+
</table>
|
92
|
+
</p>
|
93
|
+
<h3><%=tr("Example")%></h3>
|
94
|
+
<div class="code_snippet">
|
95
|
+
https://<%=Platform::Config.site_base_url %>/platform/oauth/authorize?client_id=YOUR_APP_ID&redirect_uri=YOUR_APP_URL&response_type=token&display=mobile
|
96
|
+
</div>
|
97
|
+
<p>
|
98
|
+
<%=tr("By setting the display parameter to \"mobile\", you ensure that the login and the authorization screens will use a mobile layout.")%>
|
99
|
+
<%=tr("The client_id parameter can be either your application key or your application id.")%>
|
100
|
+
<%=tr("Application ids are shorter and can be used as registered urls of your mobile application.")%>
|
101
|
+
</p>
|
102
|
+
<h3><%=tr("Configuring iOS Callback")%></h3>
|
103
|
+
<p>
|
104
|
+
<%=tr("To register a callback to your iOS application, you must open your application's properties file and configure a custom url:")%>
|
105
|
+
</p>
|
106
|
+
<pre class="code_snippet">
|
107
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
108
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
109
|
+
<plist version="1.0">
|
110
|
+
<dict>
|
111
|
+
...
|
112
|
+
<key>CFBundleURLTypes</key>
|
113
|
+
<array>
|
114
|
+
<dict>
|
115
|
+
<key>CFBundleTypeRole</key>
|
116
|
+
<string>Editor</string>
|
117
|
+
<key>CFBundleURLName</key>
|
118
|
+
<string></string>
|
119
|
+
<key>CFBundleURLSchemes</key>
|
120
|
+
<array>
|
121
|
+
<string>YOUR_APP_ID</string>
|
122
|
+
</array>
|
123
|
+
</dict>
|
124
|
+
</array>
|
125
|
+
...
|
126
|
+
</dict>
|
127
|
+
</plist>
|
128
|
+
</pre>
|
129
|
+
<p>
|
130
|
+
<%=tr("You now can provide a redirect URL that will identify your application.") %> <%=tr("See the following example:")%>
|
131
|
+
</p>
|
132
|
+
<h3><%=tr("Example")%></h3>
|
133
|
+
<pre class="code_snippet">
|
134
|
+
NSString *geniOauthBaseURL = @"https://<%=Platform::Config.site_base_url %>/platform/oauth/authorize";
|
135
|
+
|
136
|
+
NSString *yourAppURL = [NSString stringWithFormat: @"%@/authorize", YOUR_APP_ID];
|
137
|
+
|
138
|
+
NSString *geniOauthURL = [NSString stringWithFormat:@"%@?client_id=%@&redirect_uri=%@&response_type=token&display=mobile",
|
139
|
+
geniOauthBaseURL, YOUR_APP_ID, yourAppURL];
|
140
|
+
|
141
|
+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:geniOauthURL]];
|
142
|
+
</pre>
|
143
|
+
<p>
|
144
|
+
<%=tr("If the user is already logged in, we validate the login cookie that we have stored on the user's browser and authenticate the user.") %><%=tr("If the user is not logged in, they are prompted to enter their credentials:") %>
|
145
|
+
</p>
|
146
|
+
<center>
|
147
|
+
<%=image_tag("platform/help/login_iphone.png", :style=>"width:300px;") %>
|
148
|
+
</center>
|
149
|
+
<p>
|
150
|
+
<%=tr("Once we have successfully authenticated the user, we will prompt the user to authorize your application:") %>
|
151
|
+
</p>
|
152
|
+
<center>
|
153
|
+
<%=image_tag("platform/help/auth_iphone.png", :style=>"width:300px;") %>
|
154
|
+
</center>
|
155
|
+
<h3><%=tr("Handling iOS Application Callback")%></h3>
|
156
|
+
<p>
|
157
|
+
<%=tr("To handle iOS application callback, add the following code to your iOS application delegate:")%>
|
158
|
+
</p>
|
159
|
+
<pre class="code_snippet">
|
160
|
+
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *) url {
|
161
|
+
NSLog(@"Did come back from other application");
|
162
|
+
|
163
|
+
// If the URL's structure doesn't match the structure used for Geni authorization, abort.
|
164
|
+
if (![[url absoluteString] hasPrefix:[NSString stringWithFormat:@"%@://authorize", YOUR_APP_ID]]) {
|
165
|
+
return NO;
|
166
|
+
}
|
167
|
+
|
168
|
+
NSString *query = [url fragment];
|
169
|
+
if (!query) {
|
170
|
+
query = [url query];
|
171
|
+
}
|
172
|
+
|
173
|
+
// parse parameters
|
174
|
+
NSArray *pairs = [query componentsSeparatedByString:@"&"];
|
175
|
+
NSMutableDictionary *params = [[[NSMutableDictionary alloc] init] autorelease];
|
176
|
+
for (NSString *pair in pairs) {
|
177
|
+
NSArray *kv = [pair componentsSeparatedByString:@"="];
|
178
|
+
NSString *val = [[kv objectAtIndex:1]
|
179
|
+
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
180
|
+
|
181
|
+
[params setObject:val forKey:[kv objectAtIndex:0]];
|
182
|
+
}
|
183
|
+
|
184
|
+
// get access token
|
185
|
+
NSString *accessToken = [params valueForKey:@"access_token"];
|
186
|
+
|
187
|
+
// If the URL doesn't contain the access token, an error has occurred.
|
188
|
+
if (!accessToken) { // handle error
|
189
|
+
|
190
|
+
return YES;
|
191
|
+
}
|
192
|
+
|
193
|
+
// store access token
|
194
|
+
|
195
|
+
return YES;
|
196
|
+
}
|
197
|
+
</pre>
|
198
|
+
<h3><%=tr("Returned Fields") %></h3>
|
199
|
+
<p>
|
200
|
+
<table class="documentation_table">
|
201
|
+
<tr>
|
202
|
+
<th style="width:150px;">
|
203
|
+
<%=tr("Name") %>
|
204
|
+
</th>
|
205
|
+
<th style="width:150px;">
|
206
|
+
<%=tr("Type") %>
|
207
|
+
</th>
|
208
|
+
<th>
|
209
|
+
<%=tr("Description") %>
|
210
|
+
</th>
|
211
|
+
</tr>
|
212
|
+
<tr>
|
213
|
+
<td style="widtd:150px;">
|
214
|
+
status
|
215
|
+
</td>
|
216
|
+
<td style="widtd:150px;">
|
217
|
+
String
|
218
|
+
</td>
|
219
|
+
<td>
|
220
|
+
<%=tr("If user cancels the authorization flow, the status will be set to \"unauthorized\".") %>
|
221
|
+
</td>
|
222
|
+
</tr>
|
223
|
+
<tr>
|
224
|
+
<td style="widtd:150px;">
|
225
|
+
message
|
226
|
+
</td>
|
227
|
+
<td style="widtd:150px;">
|
228
|
+
String
|
229
|
+
</td>
|
230
|
+
<td>
|
231
|
+
<%=tr("Error message") %>
|
232
|
+
</td>
|
233
|
+
</tr>
|
234
|
+
</table>
|
235
|
+
</p>
|
236
|
+
<h3><%=tr("Example")%></h3>
|
237
|
+
<div class="code_snippet">
|
238
|
+
YOUR_APP_ID://authorize?status=unauthorized&message=user+canceled
|
239
|
+
</div>
|
240
|
+
<p>
|
241
|
+
<%=tr("If the user presses Allow, your app is authorized.") %>
|
242
|
+
<%=tr("The user will be redirected (via HTTP 302) to the special URL with an authorization code:") %>
|
243
|
+
</p>
|
244
|
+
<h3><%=tr("Returned Fields") %></h3>
|
245
|
+
<p>
|
246
|
+
<table class="documentation_table">
|
247
|
+
<tr>
|
248
|
+
<th style="width:150px;">
|
249
|
+
<%=tr("Name") %>
|
250
|
+
</th>
|
251
|
+
<th style="width:150px;">
|
252
|
+
<%=tr("Type") %>
|
253
|
+
</th>
|
254
|
+
<th>
|
255
|
+
<%=tr("Description") %>
|
256
|
+
</th>
|
257
|
+
</tr>
|
258
|
+
<tr>
|
259
|
+
<td style="widtd:150px;">
|
260
|
+
access_token
|
261
|
+
</td>
|
262
|
+
<td style="widtd:150px;">
|
263
|
+
String
|
264
|
+
</td>
|
265
|
+
<td>
|
266
|
+
<%=tr("Access token to be used with every API request")%>
|
267
|
+
</td>
|
268
|
+
</tr>
|
269
|
+
<tr>
|
270
|
+
<td style="widtd:150px;">
|
271
|
+
expires_in
|
272
|
+
</td>
|
273
|
+
<td style="widtd:150px;">
|
274
|
+
Number
|
275
|
+
</td>
|
276
|
+
<td>
|
277
|
+
<%=tr("Seconds until the token will expire") %>
|
278
|
+
</td>
|
279
|
+
</tr>
|
280
|
+
</table>
|
281
|
+
</p>
|
282
|
+
<h3><%=tr("Example")%></h3>
|
283
|
+
<div class="code_snippet">
|
284
|
+
YOUR_APP_ID://authorize?access_token=ACCESS_TOKEN_GENERATED_BY_SERVER&expires_in=SECONDS_UNTIL_IT_IS_EXPIRED
|
285
|
+
</div>
|
286
|
+
<h3><%=tr("Geni iOS Client SDK")%></h3>
|
287
|
+
<p>
|
288
|
+
<%=tr("{site_title} comes with a [link: full featured iOS library] that allows you to build dynamic iOS applications using the site data.", "", :site_title => Platform::Config.site_title, :link => ["/platform/developer/help/ios_sdk"])%>
|
289
|
+
<%=tr("It supports authentication, autherization and API calls to get the site data.")%>
|
290
|
+
</p>
|
291
|
+
</div>
|
292
|
+
<%= render :partial => "footer" %>
|
@@ -0,0 +1,603 @@
|
|
1
|
+
<%= render :partial => "header" %>
|
2
|
+
<div class="documentation_section_title">
|
3
|
+
<%= tr("Server Side Authorization Flow") %>
|
4
|
+
</div>
|
5
|
+
<div class="documentation_section">
|
6
|
+
<p>
|
7
|
+
<%=tr("User authentication and application authorization are handled as a two step process by redirecting the user to the login screen, followed by the authorization screen.") %>
|
8
|
+
</p>
|
9
|
+
<h2><%=tr("Authentication & Authorization") %></h2>
|
10
|
+
<p>
|
11
|
+
<%=tr("To enter the authentication/authorization flow, you must pass the following parameters to the authorization URL:") %>
|
12
|
+
</p>
|
13
|
+
<h3><%=tr("Oauth URL") %></h3>
|
14
|
+
<div class="code_snippet">
|
15
|
+
https://<%=Platform::Config.site_base_url %>/platform/oauth/authorize
|
16
|
+
</div>
|
17
|
+
<h3><%=tr("Parameters") %></h3>
|
18
|
+
<p>
|
19
|
+
<table class="documentation_table">
|
20
|
+
<tr>
|
21
|
+
<th style="width:150px;">
|
22
|
+
<%=tr("Name") %>
|
23
|
+
</th>
|
24
|
+
<th>
|
25
|
+
<%=tr("Description") %>
|
26
|
+
</th>
|
27
|
+
<th style="width:150px;">
|
28
|
+
<%=tr("Required") %>
|
29
|
+
</th>
|
30
|
+
</tr>
|
31
|
+
<tr>
|
32
|
+
<td>
|
33
|
+
client_id
|
34
|
+
</td>
|
35
|
+
<td>
|
36
|
+
<%=tr("Application key generated during the app registration.") %>
|
37
|
+
</td>
|
38
|
+
<td>
|
39
|
+
true
|
40
|
+
</td>
|
41
|
+
</tr>
|
42
|
+
<tr>
|
43
|
+
<td>
|
44
|
+
redirect_uri
|
45
|
+
</td>
|
46
|
+
<td>
|
47
|
+
<%=tr("URL that the user's browser will be redirected back to once the application authorization is completed.") %>
|
48
|
+
<%=tr("You can specify this URL in your application settings as a Callback URL, or pass it as a request paremeter.") %>
|
49
|
+
<%=tr("The redirect_uri must be within the same domain as the Site Domain you specified in the application settings.") %>
|
50
|
+
</td>
|
51
|
+
<td>
|
52
|
+
true
|
53
|
+
</td>
|
54
|
+
</tr>
|
55
|
+
<tr>
|
56
|
+
<td>
|
57
|
+
response_type
|
58
|
+
</td>
|
59
|
+
<td>
|
60
|
+
<%=tr("For the server side flow the response type is defaulted to \"code\" and you don't need to pass it as a parameter.") %>
|
61
|
+
</td>
|
62
|
+
<td>
|
63
|
+
false
|
64
|
+
</td>
|
65
|
+
</tr>
|
66
|
+
<tr>
|
67
|
+
<td>
|
68
|
+
scope
|
69
|
+
</td>
|
70
|
+
<td>
|
71
|
+
<%=tr("A comma delimited list of permissions that the application needs.") %>
|
72
|
+
<%=tr("By default the scope is set to a full data access.") %>
|
73
|
+
</td>
|
74
|
+
<td>
|
75
|
+
false
|
76
|
+
</td>
|
77
|
+
</tr>
|
78
|
+
<tr>
|
79
|
+
<td>
|
80
|
+
display
|
81
|
+
</td>
|
82
|
+
<td>
|
83
|
+
<%=tr("For the server side flow the display parameter is defaulted to \"web\".") %>
|
84
|
+
</td>
|
85
|
+
<td>
|
86
|
+
false
|
87
|
+
</td>
|
88
|
+
</tr>
|
89
|
+
<tr>
|
90
|
+
<td>
|
91
|
+
state
|
92
|
+
</td>
|
93
|
+
<td>
|
94
|
+
<%=tr("Used for additional parameters and [link: CSRF protection].", "", :link => ["http://en.wikipedia.org/wiki/Cross-site_request_forgery"]) %>
|
95
|
+
</td>
|
96
|
+
<td>
|
97
|
+
false
|
98
|
+
</td>
|
99
|
+
</tr>
|
100
|
+
</table>
|
101
|
+
</p>
|
102
|
+
<h3><%=tr("Example") %></h3>
|
103
|
+
<div class="code_snippet">
|
104
|
+
https://<%=Platform::Config.site_base_url %>/platform/oauth/authorize?client_id=YOUR_APP_KEY&redirect_uri=YOUR_URL
|
105
|
+
</div>
|
106
|
+
<p>
|
107
|
+
<%=tr("If the user is already logged in, we validate the login cookie that we have stored on the user's browser and authenticate the user.") %>
|
108
|
+
<%=tr("If the user is not logged in, they are prompted to enter their credentials:") %>
|
109
|
+
</p>
|
110
|
+
<p style="text-align:center">
|
111
|
+
<%=image_tag("platform/help/login_web.png", :style=>"width:600px;", :class => "screenshot") %>
|
112
|
+
</p>
|
113
|
+
<p>
|
114
|
+
<%=tr("Once we have successfully authenticated the user, we will prompt the user to authorize your application:") %>
|
115
|
+
</p>
|
116
|
+
<p style="text-align:center">
|
117
|
+
<%=image_tag("platform/help/auth_web.png", :style=>"width:600px;", :class => "screenshot") %>
|
118
|
+
</p>
|
119
|
+
<p>
|
120
|
+
<%=tr("If the user presses Don't Allow, your app is not authorized.") %>
|
121
|
+
<%=tr("The user will be redirected (via HTTP 302) to the URL you passed in the redirect_uri parameter with the following error information:") %>
|
122
|
+
</p>
|
123
|
+
<h3><%=tr("Returned Fields") %></h3>
|
124
|
+
<p>
|
125
|
+
<table class="documentation_table">
|
126
|
+
<tr>
|
127
|
+
<th style="width:150px;">
|
128
|
+
<%=tr("Name") %>
|
129
|
+
</th>
|
130
|
+
<th style="width:150px;">
|
131
|
+
<%=tr("Type") %>
|
132
|
+
</th>
|
133
|
+
<th>
|
134
|
+
<%=tr("Description") %>
|
135
|
+
</th>
|
136
|
+
</tr>
|
137
|
+
<tr>
|
138
|
+
<td style="widtd:150px;">
|
139
|
+
status
|
140
|
+
</td>
|
141
|
+
<td style="widtd:150px;">
|
142
|
+
String
|
143
|
+
</td>
|
144
|
+
<td>
|
145
|
+
<%=tr("If user cancels tde autdorization flow, tde status will be set to \"unauthorized\".") %>
|
146
|
+
</td>
|
147
|
+
</tr>
|
148
|
+
<tr>
|
149
|
+
<td style="widtd:150px;">
|
150
|
+
message
|
151
|
+
</td>
|
152
|
+
<td style="widtd:150px;">
|
153
|
+
String
|
154
|
+
</td>
|
155
|
+
<td>
|
156
|
+
<%=tr("Error message") %>
|
157
|
+
</td>
|
158
|
+
</tr>
|
159
|
+
</table>
|
160
|
+
</p>
|
161
|
+
<h3><%=tr("Example") %></h3>
|
162
|
+
<div class="code_snippet">
|
163
|
+
http://YOUR_URL?status=unauthorized&message=user+canceled
|
164
|
+
</div>
|
165
|
+
<p>
|
166
|
+
<%=tr("If the user presses Allow, your app is authorized.") %>
|
167
|
+
<%=tr("The user will be redirected (via HTTP 302) to the URL you passed in the redirect_uri parameter with an authorization code:") %>
|
168
|
+
</p>
|
169
|
+
<h3><%=tr("Returned Fields") %></h3>
|
170
|
+
<p>
|
171
|
+
<table class="documentation_table">
|
172
|
+
<tr>
|
173
|
+
<th style="width:150px;">
|
174
|
+
<%=tr("Name") %>
|
175
|
+
</th>
|
176
|
+
<th style="width:150px;">
|
177
|
+
<%=tr("Type") %>
|
178
|
+
</th>
|
179
|
+
<th>
|
180
|
+
<%=tr("Description") %>
|
181
|
+
</th>
|
182
|
+
</tr>
|
183
|
+
<tr>
|
184
|
+
<td style="widtd:150px;">
|
185
|
+
code
|
186
|
+
</td>
|
187
|
+
<td style="widtd:150px;">
|
188
|
+
String
|
189
|
+
</td>
|
190
|
+
<td>
|
191
|
+
<%=tr("Authorization code") %>
|
192
|
+
</td>
|
193
|
+
</tr>
|
194
|
+
<tr>
|
195
|
+
<td style="widtd:150px;">
|
196
|
+
expires_in
|
197
|
+
</td>
|
198
|
+
<td style="widtd:150px;">
|
199
|
+
Number
|
200
|
+
</td>
|
201
|
+
<td>
|
202
|
+
<%=tr("Seconds until the code is expired") %>
|
203
|
+
</td>
|
204
|
+
</tr>
|
205
|
+
<tr>
|
206
|
+
<td style="widtd:150px;">
|
207
|
+
scope
|
208
|
+
</td>
|
209
|
+
<td style="widtd:150px;">
|
210
|
+
String
|
211
|
+
</td>
|
212
|
+
<td>
|
213
|
+
<%=tr("List of permissions that the user has agreed to accept.") %>
|
214
|
+
</td>
|
215
|
+
</tr>
|
216
|
+
<tr>
|
217
|
+
<td style="widtd:150px;">
|
218
|
+
state
|
219
|
+
</td>
|
220
|
+
<td style="widtd:150px;">
|
221
|
+
String
|
222
|
+
</td>
|
223
|
+
<td>
|
224
|
+
<%=tr("Will return whatever was passed to the Oauth URL.") %>
|
225
|
+
</td>
|
226
|
+
</tr>
|
227
|
+
</table>
|
228
|
+
</p>
|
229
|
+
<h3><%=tr("Example") %></h3>
|
230
|
+
<div class="code_snippet">
|
231
|
+
http://YOUR_URL?code=A_CODE_GENERATED_BY_SERVER&expires_in=SECONDS_UNTIL_THE_CODE_IS_EXPIRED
|
232
|
+
</div>
|
233
|
+
<p>
|
234
|
+
<%=tr("With this code in hand, you can proceed to the next step, app authentication, to gain the access token you need to make API calls.") %>
|
235
|
+
</p>
|
236
|
+
<h2><%=tr("Application Authorization") %></h2>
|
237
|
+
<p>
|
238
|
+
<%=tr("In order to authenticate your app, you must pass the following parameter to the request_token endpoint:") %>
|
239
|
+
</p>
|
240
|
+
<h3><%=tr("Oauth Endpoint") %></h3>
|
241
|
+
<div class="code_snippet">
|
242
|
+
https://<%=Platform::Config.site_base_url %>/platform/oauth/request_token
|
243
|
+
</div>
|
244
|
+
<h3><%=tr("Parameters") %></h3>
|
245
|
+
<p>
|
246
|
+
<table class="documentation_table">
|
247
|
+
<tr>
|
248
|
+
<th style="width:150px;">
|
249
|
+
<%=tr("Name") %>
|
250
|
+
</th>
|
251
|
+
<th>
|
252
|
+
<%=tr("Description") %>
|
253
|
+
</th>
|
254
|
+
<th style="width:150px;">
|
255
|
+
<%=tr("Required") %>
|
256
|
+
</th>
|
257
|
+
</tr>
|
258
|
+
<tr>
|
259
|
+
<td>
|
260
|
+
client_id
|
261
|
+
</td>
|
262
|
+
<td>
|
263
|
+
<%=tr("Application key generated during the app registration.") %>
|
264
|
+
</td>
|
265
|
+
<td>
|
266
|
+
true
|
267
|
+
</td>
|
268
|
+
</tr>
|
269
|
+
<tr>
|
270
|
+
<td>
|
271
|
+
client_secret
|
272
|
+
</td>
|
273
|
+
<td>
|
274
|
+
<%=tr("Application secret generated during the registration process and availble in the application settings.") %>
|
275
|
+
</td>
|
276
|
+
<td>
|
277
|
+
true
|
278
|
+
</td>
|
279
|
+
</tr>
|
280
|
+
<tr>
|
281
|
+
<td>
|
282
|
+
redirect_uri
|
283
|
+
</td>
|
284
|
+
<td>
|
285
|
+
<%=tr("URL that was used to get the authorization code.") %><%=tr("The redirect_uri must be within the same domain as the Site Domain you specify in the application settings.") %>
|
286
|
+
</td>
|
287
|
+
<td>
|
288
|
+
true
|
289
|
+
</td>
|
290
|
+
</tr>
|
291
|
+
<tr>
|
292
|
+
<td>
|
293
|
+
code
|
294
|
+
</td>
|
295
|
+
<td>
|
296
|
+
<%=tr("Authorization code received in the previous step.") %>
|
297
|
+
</td>
|
298
|
+
<td>
|
299
|
+
true
|
300
|
+
</td>
|
301
|
+
</tr>
|
302
|
+
<tr>
|
303
|
+
<td>
|
304
|
+
grant_type
|
305
|
+
</td>
|
306
|
+
<td>
|
307
|
+
<%=tr("For the server side flow the response type is defaulted to \"authorization_code\" and you don't need to set it.") %>
|
308
|
+
</td>
|
309
|
+
<td>
|
310
|
+
false
|
311
|
+
</td>
|
312
|
+
</tr>
|
313
|
+
</table>
|
314
|
+
</p>
|
315
|
+
<h3><%=tr("Example") %></h3>
|
316
|
+
<div class="code_snippet">
|
317
|
+
https://<%=Platform::Config.site_base_url %>/platform/oauth/request_token?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&client_secret=YOUR_APP_SECRET&code=THE_CODE_FROM_ABOVE
|
318
|
+
</div>
|
319
|
+
<p>
|
320
|
+
<%=tr("If your app is successfully authenticated and the authorization code from the user is valid, the authorization server will return the access token in a JSON format:") %>
|
321
|
+
</p>
|
322
|
+
<h3><%=tr("Returned Fields") %></h3>
|
323
|
+
<p>
|
324
|
+
<table class="documentation_table">
|
325
|
+
<tr>
|
326
|
+
<th style="width:150px;">
|
327
|
+
<%=tr("Name") %>
|
328
|
+
</th>
|
329
|
+
<th style="width:150px;">
|
330
|
+
<%=tr("Type") %>
|
331
|
+
</th>
|
332
|
+
<th>
|
333
|
+
<%=tr("Description") %>
|
334
|
+
</th>
|
335
|
+
</tr>
|
336
|
+
<tr>
|
337
|
+
<td style="widtd:150px;">
|
338
|
+
access_token
|
339
|
+
</td>
|
340
|
+
<td style="widtd:150px;">
|
341
|
+
String
|
342
|
+
</td>
|
343
|
+
<td>
|
344
|
+
<%=tr("Access token to be used with every API request")%>
|
345
|
+
</td>
|
346
|
+
</tr>
|
347
|
+
<tr>
|
348
|
+
<td style="widtd:150px;">
|
349
|
+
expires_in
|
350
|
+
</td>
|
351
|
+
<td style="widtd:150px;">
|
352
|
+
Number
|
353
|
+
</td>
|
354
|
+
<td>
|
355
|
+
<%=tr("Seconds until the token will expire") %>
|
356
|
+
</td>
|
357
|
+
</tr>
|
358
|
+
<tr>
|
359
|
+
<td style="widtd:150px;">
|
360
|
+
refresh_token
|
361
|
+
</td>
|
362
|
+
<td style="widtd:150px;">
|
363
|
+
String
|
364
|
+
</td>
|
365
|
+
<td>
|
366
|
+
<%=tr("Token that can be used to get a new access token") %>
|
367
|
+
</td>
|
368
|
+
</tr>
|
369
|
+
</table>
|
370
|
+
</p>
|
371
|
+
<h3><%=tr("Example") %></h3>
|
372
|
+
<div class="code_snippet">
|
373
|
+
{"expires_in":86400,"refresh_token":"wEq6FMb3CcfPN6CckQv7","access_token":"sye4NMd130L4wqq13zjqqLHwuHd5jnnKwdVi9S8X"}
|
374
|
+
</div>
|
375
|
+
<p>
|
376
|
+
<%=tr("If your app failed to provide appropriate parameters, you will get one of the errors below in JSON format: ") %>
|
377
|
+
</p>
|
378
|
+
<h3><%=tr("Returned Fields") %></h3>
|
379
|
+
<p>
|
380
|
+
<table class="documentation_table">
|
381
|
+
<tr>
|
382
|
+
<th style="width:150px;">
|
383
|
+
<%=tr("Name") %>
|
384
|
+
</th>
|
385
|
+
<th style="width:150px;">
|
386
|
+
<%=tr("Type") %>
|
387
|
+
</th>
|
388
|
+
<th>
|
389
|
+
<%=tr("Description") %>
|
390
|
+
</th>
|
391
|
+
</tr>
|
392
|
+
<tr>
|
393
|
+
<tr>
|
394
|
+
<td style="widtd:150px;">
|
395
|
+
error
|
396
|
+
</td>
|
397
|
+
<td style="widtd:150px;">
|
398
|
+
String
|
399
|
+
</td>
|
400
|
+
<td>
|
401
|
+
<%=tr("Error code") %>
|
402
|
+
</td>
|
403
|
+
</tr>
|
404
|
+
<tr>
|
405
|
+
<td style="widtd:150px;">
|
406
|
+
error_description
|
407
|
+
</td>
|
408
|
+
<td style="widtd:150px;">
|
409
|
+
String
|
410
|
+
</td>
|
411
|
+
<td>
|
412
|
+
<%=tr("Error description") %>
|
413
|
+
</td>
|
414
|
+
</tr>
|
415
|
+
</table>
|
416
|
+
</p>
|
417
|
+
<h3><%=tr("Examples") %></h3>
|
418
|
+
<div class="code_snippet">
|
419
|
+
{"error_description":"invalid client application id","error":"unauthorized_client"}
|
420
|
+
<br>
|
421
|
+
<br>
|
422
|
+
{"error_description":"redirection url must match the url used for the code request","error":"invalid_request"}
|
423
|
+
</div>
|
424
|
+
<h3><%=tr("Full Example in PHP") %></h3>
|
425
|
+
<p>
|
426
|
+
<%=tr("The following example demonstrates an authentication/autherization flow in a single PHP page.") %><%=tr("The example uses [link: CSRF protection] for extra security.", "", :link => ["http://en.wikipedia.org/wiki/Cross-site_request_forgery"]) %>
|
427
|
+
</p>
|
428
|
+
<pre class="code_snippet">
|
429
|
+
<?php
|
430
|
+
|
431
|
+
$app_id = "YOUR_APP_KEY";
|
432
|
+
$app_secret = "YOUR_APP_SECRET";
|
433
|
+
$my_url = "YOUR_URL";
|
434
|
+
|
435
|
+
session_start();
|
436
|
+
$access_code = $_REQUEST["code"];
|
437
|
+
|
438
|
+
if (empty($access_code)) {
|
439
|
+
$_SESSION['state'] = md5(uniqid(rand(), TRUE)); // CSRF protection
|
440
|
+
|
441
|
+
$geni_oauth_url = "http://www.facebook.com/dialog/oauth?client_id=" . $app_id
|
442
|
+
. "&redirect_uri=" . urlencode($my_url) . "&state=" . $_SESSION['state'];
|
443
|
+
|
444
|
+
echo("<script> top.location.href='" . $geni_oauth_url . "'</script>");
|
445
|
+
}
|
446
|
+
|
447
|
+
if ($_REQUEST['state'] == $_SESSION['state']) {
|
448
|
+
$token_url = "https://www.geni.com/oauth/request_token?client_id=" . $app_id . "&client_secret=" . $app_secret
|
449
|
+
. "&redirect_uri=" . urlencode($my_url) . "&code=" . $access_code;
|
450
|
+
|
451
|
+
$params = json_decode(file_get_contents($token_url), true);
|
452
|
+
|
453
|
+
$geni_api_url = "https://www.geni.com/api/profile?access_token=" . $params['access_token'];
|
454
|
+
|
455
|
+
$profile = json_decode(file_get_contents($geni_api_url));
|
456
|
+
|
457
|
+
echo("Hello " . $profile->name);
|
458
|
+
} else {
|
459
|
+
|
460
|
+
echo("Error: CSRF validation failed. Someone is attacking your site!");
|
461
|
+
}
|
462
|
+
?>
|
463
|
+
</pre>
|
464
|
+
<h2><%=tr("Refreshing Access Token") %></h2>
|
465
|
+
<p>
|
466
|
+
<%=tr("If your access token has expired and you have a refresh token, you can get a new access token for the same scope by calling the oauth endpoint:") %>
|
467
|
+
</p>
|
468
|
+
<h3><%=tr("Oauth Endpoint") %></h3>
|
469
|
+
<div class="code_snippet">
|
470
|
+
https://<%=Platform::Config.site_base_url %>/platform/oauth/request_token
|
471
|
+
</div>
|
472
|
+
<h3><%=tr("Parameters") %></h3>
|
473
|
+
<p>
|
474
|
+
<table class="documentation_table">
|
475
|
+
<tr>
|
476
|
+
<th style="width:150px;">
|
477
|
+
<%=tr("Name") %>
|
478
|
+
</th>
|
479
|
+
<th>
|
480
|
+
<%=tr("Description") %>
|
481
|
+
</th>
|
482
|
+
<th style="width:150px;">
|
483
|
+
<%=tr("Required") %>
|
484
|
+
</th>
|
485
|
+
</tr>
|
486
|
+
<tr>
|
487
|
+
<td>
|
488
|
+
client_id
|
489
|
+
</td>
|
490
|
+
<td>
|
491
|
+
<%=tr("Application key generated during the app registration.") %>
|
492
|
+
</td>
|
493
|
+
<td>
|
494
|
+
true
|
495
|
+
</td>
|
496
|
+
</tr>
|
497
|
+
<tr>
|
498
|
+
<td>
|
499
|
+
client_secret
|
500
|
+
</td>
|
501
|
+
<td>
|
502
|
+
<%=tr("Application secret generated during the registration process and availble in the application settings.") %>
|
503
|
+
<%=tr("The app secret is available from the Developer App and should not be shared with anyone or embedded in any code that you will distribute (you should use the client-side flow for these scenarios).") %>
|
504
|
+
</td>
|
505
|
+
<td>
|
506
|
+
true
|
507
|
+
</td>
|
508
|
+
</tr>
|
509
|
+
<tr>
|
510
|
+
<td>
|
511
|
+
redirect_uri
|
512
|
+
</td>
|
513
|
+
<td>
|
514
|
+
<%=tr("URL that was used to get the refresh token.") %><%=tr("The redirect_uri must be within the same domain as the Site Domain you specify in the application settings.") %>
|
515
|
+
</td>
|
516
|
+
<td>
|
517
|
+
true
|
518
|
+
</td>
|
519
|
+
</tr>
|
520
|
+
<tr>
|
521
|
+
<td>
|
522
|
+
refresh_token
|
523
|
+
</td>
|
524
|
+
<td>
|
525
|
+
<%=tr("Refresh token value") %>
|
526
|
+
</td>
|
527
|
+
<td>
|
528
|
+
true
|
529
|
+
</td>
|
530
|
+
</tr>
|
531
|
+
<tr>
|
532
|
+
<td>
|
533
|
+
grant_type
|
534
|
+
</td>
|
535
|
+
<td>
|
536
|
+
<%=tr("In order to refresh a token, set this param to \"refresh_token\"") %>
|
537
|
+
</td>
|
538
|
+
<td>
|
539
|
+
true
|
540
|
+
</td>
|
541
|
+
</tr>
|
542
|
+
</table>
|
543
|
+
</p>
|
544
|
+
<h3><%=tr("Example") %></h3>
|
545
|
+
<div class="code_snippet">
|
546
|
+
https://<%=Platform::Config.site_base_url %>/platform/oauth/request_token?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&client_secret=YOUR_APP_SECRET
|
547
|
+
&grant_type=refresh_token&refresh_token=REFRESH_TOKEN
|
548
|
+
</div>
|
549
|
+
<h3><%=tr("Returned Fields") %></h3>
|
550
|
+
<p>
|
551
|
+
<table class="documentation_table">
|
552
|
+
<tr>
|
553
|
+
<th style="width:150px;">
|
554
|
+
<%=tr("Name") %>
|
555
|
+
</th>
|
556
|
+
<th style="width:150px;">
|
557
|
+
<%=tr("Type") %>
|
558
|
+
</th>
|
559
|
+
<th>
|
560
|
+
<%=tr("Description") %>
|
561
|
+
</th>
|
562
|
+
</tr>
|
563
|
+
<tr>
|
564
|
+
<td style="widtd:150px;">
|
565
|
+
access_token
|
566
|
+
</td>
|
567
|
+
<td style="widtd:150px;">
|
568
|
+
String
|
569
|
+
</td>
|
570
|
+
<td>
|
571
|
+
<%=tr("Access token to be used with every request to Geni API") %>
|
572
|
+
</td>
|
573
|
+
</tr>
|
574
|
+
<tr>
|
575
|
+
<td style="widtd:150px;">
|
576
|
+
expires_in
|
577
|
+
</td>
|
578
|
+
<td style="widtd:150px;">
|
579
|
+
Number
|
580
|
+
</td>
|
581
|
+
<td>
|
582
|
+
<%=tr("Seconds until the token will expire") %>
|
583
|
+
</td>
|
584
|
+
</tr>
|
585
|
+
<tr>
|
586
|
+
<td style="widtd:150px;">
|
587
|
+
refresh_token
|
588
|
+
</td>
|
589
|
+
<td style="widtd:150px;">
|
590
|
+
String
|
591
|
+
</td>
|
592
|
+
<td>
|
593
|
+
<%=tr("Token that can be used to get a new access token") %>
|
594
|
+
</td>
|
595
|
+
</tr>
|
596
|
+
</table>
|
597
|
+
</p>
|
598
|
+
<h3><%=tr("Example") %></h3>
|
599
|
+
<div class="code_snippet">
|
600
|
+
{"expires_in":86400,"refresh_token":"wEq6FMb3CcfPN6CckQv7","access_token":"sye4NMd130L4wqq13zjqqLHwuHd5jnnKwdVi9S8X"}
|
601
|
+
</div>
|
602
|
+
</div>
|
603
|
+
<%= render :partial => "footer" %>
|